﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Warranty.Model.Interface;
using Warranty.Model.Model;
using Common.Util;

namespace Warranty.Provider
{
    public class SerialNoPrintedProvider : GenericProvider, ISerialNoPrintedProvider
    {
        public List<SerialNoPrinted> SerialNoPrinted(string serial, string serialNoUsage = "")
        {
            var query = repository.GetQuery<SerialNoPrinted>();

            if (!serial.IsNullOrWhiteSpace())
                query = query.Where(x => x.SerialNo.ToUpper() == serial.ToUpper());

            if (!serialNoUsage.IsNullOrWhiteSpace())
                query = query.Where(x => x.SerialNoUsage.ToUpper().Contains(serialNoUsage.ToUpper()));

            return query.ToList();
        }
    }
}
